package com.itboye.allshengmedical.sci.packet.req;

import com.example.allshengmedical.util.ByAlert;
import com.itboye.allshengmedical.sci.HexHelper;

import android.R.integer;
import android.os.Looper;

public class LightJustReqPacket extends BaseReqPacket {
	public LightJustReqPacket() {
		this.setStart(new byte[] { (byte) 0x5A, (byte) 0xA5 });

		this.setLen((byte) 0x04);
		this.setContent(new byte[] { (byte) 0x08, (byte) 0x00, (byte) 0x00,
				(byte) 0x00 });

		this.calCheckBit();

		this.setEnd(new byte[] { (byte) 0x3E, (byte) 0xE3 });
	}

	public void LightJust(int temp) {
		if (temp >= 0 && temp <= 100) {
			byte[] byteTemp = HexHelper.intToBytes(temp);
			this.setContent(1, byteTemp[0]);
			this.setContent(2, byteTemp[1]);
		} else {
			Looper.prepare();
			ByAlert.alert("值非法");
			Looper.loop();
		}

	}

}
